package com.ncmx.lmax.util;

import java.security.SecureRandom;

/**
 * The Class EnumUtils.
 */
public class EnumUtils {
	
	/**
	 * Random enum.
	 *
	 * @param <T> the generic type
	 * @param clazz the clazz
	 * @return the t
	 */
	public static <T extends Enum<?>> T randomEnum(Class<T> clazz) {
		final SecureRandom random = new SecureRandom();
		int x = random.nextInt(clazz.getEnumConstants().length);
		return clazz.getEnumConstants()[x];
	}
}
